﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace RN.ERP
{
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码和配置文件中的接口名“IAuthorityService”。
    [ServiceContract]
    public interface IAuthorityService
    {
        /// <summary>
        /// 获取角色列表
        /// </summary>
        /// <param name="title">名称</param>
        /// <param name="code">编号</param>
        /// <param name="areacode">地区编号</param>
        /// <param name="description">描述</param>
        /// <returns></returns>
        [OperationContract]
        string GetRoles(string title, string code, string areacode, string description);
        /// <summary>
        /// 根据角色GuID获取角色信息
        /// </summary>
        /// <param name="guid"></param>
        /// <returns></returns>
        [OperationContract]
        string GetRoleByGuId(Guid guid);
        /// <summary>
        /// 添加角色
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
        [OperationContract]
        string AddRole(DTO.T_Sys_Roles role);
        /// <summary>
        /// 修改角色信息
        /// </summary>
        /// <param name="roleDTO"></param>
        /// <returns></returns>
        [OperationContract]
        string UpdateRole(DTO.T_Sys_Roles roleDTO);
        /// <summary>
        /// 删除角色
        /// </summary>
        /// <param name="roleId"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        [OperationContract]
        string DeleteRole(string roleGuid);
        /// <summary>
        /// 根据角色Guid获取人员信息
        /// </summary>
        /// <param name="roleGuid"></param>
        /// <returns></returns>
        [OperationContract]
        string GetUserListByRoleGuid(Guid roleGuid);
        /// <summary>
        /// 根据角色Guid和用户Guid删除用户的角色
        /// </summary>
        /// <param name="roleGuid"></param>
        /// <param name="userGuid"></param>
        /// <returns></returns>
        [OperationContract]
        string DeleteByUserRole(string roleGuid, string userGuid);
        /// <summary>
        /// 判断人员是否有角色
        /// </summary>
        /// <param name="roleGuid"></param>
        /// <param name="userGuid"></param>
        /// <returns></returns>
        [OperationContract]
        string GetUserRoleByUserRole(string roleGuid, string userGuid, string userID);
        /// <summary>
        /// 根绝角色Guid获取人员角色表
        /// </summary>
        /// <param name="roleGuid"></param>
        /// <returns></returns>
        [OperationContract]
        string GetUserRolesByRoleGuid(Guid roleGuid);
        [OperationContract]
        string GetFuncByFuncObj(string objGuid, string funcGuid, string userID);

        [OperationContract]
        string UpdateFunction(DTO.T_Sys_Function function);
        [OperationContract]
        string GetFunctionList(DTO.FuncQueryCondition condition);
        [OperationContract]
        string DeleteFunction(Guid funcGuid);
        [OperationContract]
        string AddFunction(DTO.T_Sys_Function function);
        [OperationContract]
        string GetFunctionByGuid(Guid funcGuid);
        [OperationContract]
        string GetMenuList(Guid userGuid, string appID);
        [OperationContract]
        string GetConFunctionList(Guid funcGuid);
        [OperationContract]
        string AddConFunction(DTO.T_Sys_ControlFunction conFuncDTO);
        [OperationContract]
        string OperateConFunction(Guid funcGuid, Guid conGuid, DTO.OperationType type);

        #region 用户角色 作者：孙正滨
        /// <summary>
        /// 获取用户列表(绑定到下拉菜单)
        /// </summary>
        /// <param name="corpName">公司名称</param>
        /// <returns></returns>
        [OperationContract]
        string GetUserList(string corpName, string username);

        /// <summary>
        /// 设置用户
        /// </summary>
        /// <param name="userGuid"></param>
        /// <param name="roleNum"></param>
        /// <param name="roleArea"></param>
        /// <returns></returns>
        [OperationContract]
        string SetUserRole(Guid userGuid, string roleNum, string roleArea);

        /// <summary>
        /// 获取用户角色列表
        /// </summary>
        /// <param name="userGuid">用户GUID</param>
        /// <returns></returns>
        [OperationContract]
        string GetUserRoles(Guid userGuid);
        /// <summary>
        /// 获取用户角色列表
        /// </summary>
        /// <param name="userGuid">用户GUID</param>
        /// <param name="roleGuid">角色GUID</param>
        /// <returns></returns>
        [OperationContract]
        string GetUserRolesList(Guid userGuid, Guid roleGuid);
        /// <summary>
        /// 根据用户角色ID获取角色信息
        /// </summary>
        /// <param name="id">用户角色ID</param>
        /// <returns></returns>
        [OperationContract]
        string GetUserRoleById(int id);
        /// <summary>
        /// 根据角色GUID获取用户角色信息
        /// </summary>
        /// <param name="roleGuid">角色GUID</param>
        /// <returns></returns>
        [OperationContract]
        string GetUserRoleByGuId(Guid roleGuid);
        /// <summary>
        /// 添加用户角色
        /// </summary>
        /// <param name="userGuid">用户GUID</param>
        /// <param name="roleGuid">角色GUID</param>
        /// <param name="userID">添加人GUID</param>
        /// <returns></returns>
        [OperationContract]
        string AddUserRole(DTO.T_Sys_UserRole userRole);
        /// <summary>
        /// 修改用户角色
        /// </summary>
        /// <param name="id">用户角色ID</param>
        /// <param name="roleGuid">角色GUID</param>
        /// <param name="userID">添加人GUID</param>
        /// <returns></returns>
        [OperationContract]
        string UpdateUserRole(DTO.T_Sys_UserRole userRole);
        /// <summary>
        /// 根据用户角色ID或者角色GUID删除用户角色
        /// </summary>
        /// <param name="roleID">角色ID或角色GUID</param>
        /// <param name="type">0:通过ID,1:通过Guid</param>
        /// <returns></returns>
        [OperationContract]
        string DeleteUserRole(string roleGuid, string userRole);
        #endregion

        [OperationContract]
        string AddFuncPermission(DTO.T_Sys_FuncPermission funcDTO);
        [OperationContract]
        string DelFuncPermission(Guid funcGuid, Guid objGuid);
        [OperationContract]
        string GetFuncPermission(Guid guid, string appid);
        [OperationContract]
        string GetControls(string title, string method, string clientlMethod, string description);
        [OperationContract]
        string GetControlByGuId(Guid guid);
        [OperationContract]
        string GetControlByFunGuid(Guid funguid);
        [OperationContract]
        string AddControl(DTO.T_Sys_Control controlDTO);
        [OperationContract]
        string UpdateControl(DTO.T_Sys_Control controlDTO);
        [OperationContract]
        string DeleteControl(string controlGuid);
        [OperationContract]
        string GetFunction();

        #region 用户添加功能 作者: 孙正滨
        [OperationContract]
        string CheckFuncByUserGuid(string objGuid, string funcGuid);
        [OperationContract]
        string GetFuncListByUserGuid(Guid objGuid);
        [OperationContract]
        string ChechFuncByFuncObj(string objGuid, string funcGuid, string userID);
        #endregion

        #region UC控件调用
        [OperationContract]
        List<DTO.tb_Emp_TitleClass> GetPsnQualLevelByType(int nid);
        #endregion UC控件调用
        [OperationContract]
        int GetUserCount(string corpName);
        [OperationContract]
        string CheckPermission(string funcGuid, string objGuid, int funcType, int type, bool ischeck);
        [OperationContract]
        string GetUserFunctions(string userGuid, string functionGuid, string appId);
        [OperationContract]
        string GetUserControls(string userGuid, string functionGuid, string appId);
        [OperationContract]
        string GetUserMenus(string userGuid, string functionGuid, string appId);
        [OperationContract]
        string GetUserFuncCodes(string userGuid, bool isMenu, string appId);
        [OperationContract]
        string GetRoleFunctions(string roleGuid, string functionGuid, string appId);
         [OperationContract]
        string AddPageMapping(DTO.FuncPageMapping page);

        #region  系统开通
        [OperationContract]
        string GetSysApp();
        [OperationContract]
        string GetUserSysPermission(string userGuid, int type);
        [OperationContract]
        string UpdatePermission(DTO.T_Sys_FuncPermission funcDTO);

        [OperationContract]
        string GetFuncPermissionForUser(Guid roleGuid, Guid userGuid, string appid);
        [OperationContract]
        string SaveorUpdateFuncPermissionForUser(Guid roleGuid, Guid userGuid, string appid, List<string> addFuncs);
        #endregion

        #region 部门管理
        [OperationContract]
        string GetDepartmentData(string AreaCode);
        [OperationContract]
        string AddDepartment(DTO.dict_Department dept);
        [OperationContract]
        string UpdateDepartment(DTO.dict_Department dept);
        [OperationContract]
        string DeleteDepartment(int id);

        #endregion
    }
}
